package org.xiaofeipapa.feimall.common.event;

import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEventPublisherAware;

import java.util.Objects;

/**
 * 作者: 小肥爬爬
 * 简书: https://www.jianshu.com/u/db796a501972
 * gitee: https://gitee.com/xiaofeipapa
 * 邮箱: imyunshi@163.com
 * 您可以自由转载此博客文章, 恳请保留原链接, 谢谢!
 **/
public class UserPayEvent extends RemoteApplicationEvent {

    String userName;
    Boolean succ;           // 是否成功

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Boolean getSucc() {
        return succ;
    }

    public void setSucc(Boolean succ) {
        this.succ = succ;
    }

    // 重新定义构造方法
    public UserPayEvent(Object source, String originService, String destinationService, String userName, Boolean succ) {
        super(source, originService, destinationService);
        this.userName = userName;
        this.succ = succ;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        UserPayEvent that = (UserPayEvent) o;
        return Objects.equals(userName, that.userName) &&
                Objects.equals(succ, that.succ);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), userName, succ);
    }

    @Override
    public String toString() {
        return "UserPayEvent{" +
                "userName='" + userName + '\'' +
                ", succ=" + succ +
                '}';
    }
}
